#include <iostream>

#include <unistd.h>
#include <pthread.h>

void* threadrun(void* args)
{
    for (int i = 0; i < 5; ++i)
    {
        std::cout << "I am thread" << std::endl;
        sleep(1);
    }
    return nullptr;
}

int main()
{
    pthread_t tid;
    pthread_create(&tid, nullptr, threadrun, nullptr);
    
    sleep(3);
    std::cout << "main exit" << std::endl;
    pthread_exit(nullptr);

    return 0;
}